/**
 * Path.h
 * Coyright (c) 2009 Xiaofeng Gu. All Rights Reserved.
 * Author : Xiaofeng Gu
 *
 * Creation Data : 2009/06/11
 */

#pragma once

#include "Vec.h"
#include <vector>

typedef std::vector<double>		Path3d;
typedef std::vector<double>		Parts;

class CTransPath
{
public:
	CTransPath();
	virtual ~CTransPath();

	enum PathType
	{
		eNone = -1,
		eLinearPath,
		eCirclePath
	};

// method
	virtual void			Create();
	static bool				IsLinearPath(CVec& startDir, CVec& endDir);


// property
	virtual PathType		GetType() { return eNone; }

	CVec*					GetStart()
	{ return &start; }
	CVec*					GetEnd()
	{ return &end; }

	void					SetItemCount(long lValue) { m_lItemCount = lValue; }
	void					SetGradRatio(double value) { gradRatio = value; }

	Path3d*					GetPath()
	{ return &m_oPath; }

protected:
	virtual double			CalculateRange() { return 0; }

protected:
	Path3d					m_oPath;
	Parts					m_oParts;
	CVec					start;
	CVec					end;
	double					gradRatio;
	long					m_lItemCount;
};



class CLinearPath : public CTransPath
{
public:

// method
	virtual void			Create();
	virtual PathType		GetType() { return eLinearPath; }

protected:
	virtual double			CalculateRange();

private:
	
};



class CCirclePath : public CTransPath
{
public:

// method
	virtual void			Create();
	virtual PathType		GetType() { return eCirclePath; }
	CVec&					GetStartTangent() { return tangentStart; }
	CVec&					GetEndTangent() { return tangentEnd; }

protected:
	virtual double			CalculateRange();

private:
	void					CalculateCenter();

private:
	CVec					center;
	CVec					tangentStart;
	CVec					tangentEnd;

	double					m_Radius;
};